/*    */ package com.behavior.template.jdbc;
/*    */ 
/*    */ import java.sql.Connection;
/*    */ import java.sql.DriverManager;
/*    */ import java.sql.PreparedStatement;
/*    */ import java.sql.SQLException;
/*    */ 
/*    */ public abstract class JdbcTemplate
/*    */ {
/* 10 */   protected Connection connection = null;
/* 11 */   protected PreparedStatement statement = null;
/*    */ 
/*    */   protected void prepared(String sql) {
/*    */     try {
/* 15 */       Class.forName("com.mysql.jdbc.Driver");
/* 16 */       this.connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/basictest", "root", "123456");
/* 17 */       this.statement = this.connection.prepareStatement(sql);
/*    */     } catch (SQLException e) {
/* 19 */       e.printStackTrace();
/*    */     } catch (ClassNotFoundException e) {
/* 21 */       e.printStackTrace();
/*    */     }
/*    */   }
/*    */ 
/*    */   protected abstract void setParam(Object paramObject) throws SQLException;
/*    */ 
/*    */   protected void closeSource() throws SQLException {
/* 28 */     if (this.connection != null) {
/* 29 */       this.connection.close();
/*    */     }
/* 31 */     if (this.statement != null)
/* 32 */       this.statement.close();
/*    */   }
/*    */ 
/*    */   public final void doOpera(String sql, Object object) throws SQLException
/*    */   {
/* 37 */     prepared(sql);
/* 38 */     setParam(object);
/* 39 */     closeSource();
/*    */   }
/*    */ }

/* Location:           C:\Users\lenovo\Desktop\DesignMode.jar
 * Qualified Name:     com.behavior.template.jdbc.JdbcTemplate
 * JD-Core Version:    0.6.2
 */